package com.Txunda.fxw.ui.http;

import com.Txunda.fxw.base.web.ApiListener;
import com.Txunda.fxw.base.web.ApiTool;
import com.Txunda.fxw.ui.toolkit.config.Config;
import com.lidroid.xutils.http.RequestParams;

/**
 * =======================================
 * 作   者：Hwangzj
 * 创建时间：2018/11/15 19:34
 * 代码描述：
 * 修改历史：
 * 说   明：
 * =======================================
 */
public class Member {


    public void login(String account, String password, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addBodyParameter("account", account);
        params.addBodyParameter("password", password);
        apiTool.postApi(Config.BASE_URL + "Member/login", params, apiListener);
    }

    public void register(String account, String verify, String password, String sec_password, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addBodyParameter("account", account);
        params.addBodyParameter("verify", verify);
        params.addBodyParameter("password", password);
        params.addBodyParameter("sec_password", sec_password);
        apiTool.postApi("http://www.yiyuanchazuo.com/index.php/Api/Member/register", params, apiListener);
    }

    public void resetPassword(String account, String verify, String new_password, String sec_password, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addBodyParameter("account", account);
        params.addBodyParameter("verify", verify);
        params.addBodyParameter("new_password", new_password);
        params.addBodyParameter("sec_password", sec_password);
        apiTool.postApi(Config.BASE_URL + "Member/resetPassword", params, apiListener);
    }

    public void sendVerify(String account, String type, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addBodyParameter("account", account);
        params.addBodyParameter("type", type);
        apiTool.postApi(Config.BASE_URL + "Member/sendVerify", params, apiListener);
    }

}
